using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using GetSharePointToValidate;

namespace GetSharePointToValidate.DeploymentJobs
{
    
    public class ModifierCompatBrowerJobs : SPJobDefinition
    {
        private const string propertyName = "AddOrRemoveCompatBrowerElements";

        public ModifierCompatBrowerJobs() : base()
        {
        }
        public ModifierCompatBrowerJobs(string JobName, SPService Service, SPServer Server, SPJobLockType TargetType)
            : base(JobName, Service, Server, TargetType)
        { 
        }
        public ModifierCompatBrowerJobs(string JobName, SPWebApplication WebApplication)
            : base(JobName, WebApplication, null, SPJobLockType.None)
        {
            this.Title = "Modifier the compat.brower";
        }
        public override void Execute(Guid targetInstanceId)
        {
            SPWebApplication webApplication = this.Parent as SPWebApplication;
            Deployment.ModifierCompatBrower mcb = new Deployment.ModifierCompatBrower(webApplication);
            mcb.Modifier(this.AddModifierOrRemoveModifier);
        }

        public bool AddModifierOrRemoveModifier
        {
            get {
                
                if (this.Properties.ContainsKey(propertyName))
                    return Convert.ToBoolean(this.Properties[propertyName].ToString());
                else
                    return false;
            }
            set {
                if (!this.Properties.ContainsKey(propertyName))
                {
                    this.Properties.Add(propertyName, value);
                }
            }
        }
    }
}
